package com.duke.shaking.profile;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.duke.shaking.R;
import com.duke.shaking.TitleActivity;

public class InputNicknameActivity extends TitleActivity {
	
	private EditText txt_nickname;
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		txt_nickname = (EditText)findViewById(R.id.edit_nickname);
	}

	@Override
	protected int getLayoutId() {
		// TODO Auto-generated method stub
		return R.layout.activity_input_nickname;
	}

	@Override
	protected void onTitleInit() {
		// TODO Auto-generated method stub
		initTitle(0, //TITLE_BTN_EXIST | TITLE_BTN_BACK,
				R.string.back,
				TITLE_BTN_EXIST,
				R.string.next,
				R.string.title_input_nickname);
	}
	
	public void onRightBtn(View v) {
		if (txt_nickname == null) {
			return;
		}
		String nickname = txt_nickname.getText().toString();
		if (nickname != null) {
			nickname = nickname.trim();
		}
		if (nickname == null || nickname.equals("")) {
			return;
		}
		if (me != null) {
			me.setNickname(nickname);
		}
		go(InputBirthdayActivity.class);
	}
}
